{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "import tensorflow as tf\n",
    "\n",
    "import keras\n",
    "from keras.models import Sequential\n",
    "from keras.layers import Conv2D, MaxPooling2D, AveragePooling2D\n",
    "from keras.layers import Dense, Activation, Dropout, Flatten\n",
    "\n",
    "from keras.preprocessing import image\n",
    "from keras.preprocessing.image import ImageDataGenerator\n",
    "\n",
    "import numpy as np\n",
    "import matplotlib.pyplot as plt"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.environ[\"CUDA_VISIBLE_DEVICES\"]=\"1\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_classes = 7 #angry, disgust, fear, happy, sad, surprise, neutral\n",
    "batch_size = 256\n",
    "epochs = 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "with open(\"/workspaces/sefik/fer2013/fer2013.csv\") as f:\n",
    "    content = f.readlines()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "lines = np.array(content)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "number of instances:  35888\n",
      "instance length:  2304\n"
     ]
    }
   ],
   "source": [
    "num_of_instances = lines.size\n",
    "print(\"number of instances: \",num_of_instances)\n",
    "print(\"instance length: \",len(lines[1].split(\",\")[1].split(\" \")))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [],
   "source": [
    "x_train, y_train, x_test, y_test = [], [], [], []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "for i in range(1,num_of_instances):\n",
    "    try:\n",
    "        emotion, img, usage = lines[i].split(\",\")\n",
    "          \n",
    "        val = img.split(\" \")\n",
    "            \n",
    "        pixels = np.array(val, 'float32')\n",
    "        \n",
    "        #emotion = keras.utils.to_categorical(emotion, num_classes)\n",
    "        \n",
    "        #print(emotion)\n",
    "    \n",
    "        if 'Training' in usage:\n",
    "            y_train.append(emotion)\n",
    "            x_train.append(pixels)\n",
    "        elif 'PublicTest' in usage:\n",
    "            y_test.append(emotion)\n",
    "            x_test.append(pixels)\n",
    "    except Exception as ex:\n",
    "        print(ex)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "28709 train samples\n",
      "3589 test samples\n"
     ]
    }
   ],
   "source": [
    "x_train = np.array(x_train, 'float32')\n",
    "y_train = np.array(y_train, 'float32')\n",
    "x_test = np.array(x_test, 'float32')\n",
    "y_test = np.array(y_test, 'float32')\n",
    "\n",
    "x_train /= 255 #normalize inputs between [0, 1]\n",
    "x_test /= 255\n",
    "\n",
    "x_train = x_train.reshape(x_train.shape[0], 48, 48, 1)\n",
    "x_train = x_train.astype('float32')\n",
    "x_test = x_test.reshape(x_test.shape[0], 48, 48, 1)\n",
    "x_test = x_test.astype('float32')\n",
    "\n",
    "print(x_train.shape[0], 'train samples')\n",
    "print(x_test.shape[0], 'test samples')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(48, 48, 1)"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train[0].shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import autokeras as ak"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Saving Directory: /workspaces/sefik/automodels/\n"
     ]
    }
   ],
   "source": [
    "model = ak.ImageClassifier(path=\"/workspaces/sefik/automodels/\", verbose=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(28709, 48, 48, 1)"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "x_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(28709,)"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "y_train.shape"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Preprocessing the images.\n",
      "Preprocessing finished.\n",
      "\n",
      "Initializing search.\n",
      "Initialization finished.\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 0               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           0            |   5.586169672012329    |  0.48439999999999994   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 1               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           1            |   3.8872979521751403   |         0.6352         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 2               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           2            |   3.7268658876419067   |         0.6484         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 3               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "\n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           3            |   3.908575916290283    |   0.6416000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 4               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           4            |   3.6182793498039247   |         0.662          |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 5               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           5            |   3.8480388045310976   |         0.6484         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 6               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           6            |   3.684954035282135    |   0.6536000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 7               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           7            |   3.6856489777565002   |   0.6544000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 8               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           8            |   3.692846381664276    |         0.6548         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|               Training model 9               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           9            |   3.707293725013733    |         0.6568         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 10               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           10           |   3.6808403015136717   |   0.6479999999999999   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 11               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           11           |   3.607499587535858    |         0.6552         |\n",
      "+--------------------------------------------------------------------------+\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 12               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           12           |   3.8213101387023927   |   0.6524000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 13               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           13           |   3.6762778401374816   |         0.6636         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 14               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           14           |   3.662202274799347    |         0.6576         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 15               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           15           |   3.8050533056259157   |         0.6488         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 16               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           16           |   3.7074296951293944   |         0.6564         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 17               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           17           |   3.7351277470588684   |   0.6504000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 18               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           18           |   3.5674387574195863   |   0.6664000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 19               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           19           |   3.6857590675354004   |         0.6552         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 20               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           20           |   3.8392929434776306   |         0.6508         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 21               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           21           |   3.7968435883522034   |         0.662          |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 22               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           22           |   3.717673325538635    |   0.6652000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 23               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           23           |   3.5962515592575075   |         0.6652         |\n",
      "+--------------------------------------------------------------------------+\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 24               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           24           |   3.7875988364219664   |         0.658          |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 25               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           25           |   3.743686842918396    |         0.6552         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 26               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           26           |   3.807344686985016    |         0.6492         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 27               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           27           |   3.7860191464424133   |   0.6544000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 28               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           28           |   3.7389588356018066   |         0.6636         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 29               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           29           |   3.650455594062805    |         0.6744         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 30               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           30           |   3.812918519973755    |   0.6464000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 31               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           31           |   3.694933831691742    |         0.6572         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 32               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           32           |   3.683915114402771    |         0.6644         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 33               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           33           |   3.7709042549133303   |         0.652          |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 34               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           34           |   3.659564459323883    |   0.6664000000000001   |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 35               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           35           |   3.8069435477256777   |   0.6540000000000001   |\n",
      "+--------------------------------------------------------------------------+\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 36               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           36           |   3.748728704452515    |         0.6588         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 37               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           37           |   3.696304500102997    |         0.6656         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 38               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           38           |   3.6297285318374635   |         0.6584         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 39               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           39           |   3.823110818862915    |         0.6512         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 40               |\n",
      "+----------------------------------------------+\n",
      "                                                                                                    \n",
      "No loss decrease after 5 epochs.\n",
      "\n",
      "\n",
      "Saving model.\n",
      "+--------------------------------------------------------------------------+\n",
      "|        Model ID        |          Loss          |      Metric Value      |\n",
      "+--------------------------------------------------------------------------+\n",
      "|           40           |   3.762257432937622    |         0.6532         |\n",
      "+--------------------------------------------------------------------------+\n",
      "\n",
      "\n",
      "+----------------------------------------------+\n",
      "|              Training model 41               |\n",
      "+----------------------------------------------+\n",
      "Epoch-10, Current Metric - 0.668:  59%|█████████████▌         | 130/221 [01:24<01:02,  1.45 batch/s]Time is out.\n"
     ]
    }
   ],
   "source": [
    "model.fit(x_train, y_train, time_limit=60*60*24)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                                                                                    \n",
      "No loss decrease after 30 epochs.\n",
      "\n"
     ]
    }
   ],
   "source": [
    "model.final_fit(x_train, y_train, x_test, y_test, retrain=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [],
   "source": [
    "score = model.evaluate(x_test, y_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6623014767344664"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [],
   "source": [
    "predictions = model.predict(x_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Prediction:  2.0 , Actual:  0.0\n",
      "Prediction:  1.0 , Actual:  1.0\n",
      "Prediction:  0.0 , Actual:  4.0\n",
      "Prediction:  2.0 , Actual:  6.0\n",
      "Prediction:  3.0 , Actual:  3.0\n"
     ]
    }
   ],
   "source": [
    "instances = 0\n",
    "correct_ones = 0\n",
    "\n",
    "for i in range(0, len(predictions)):\n",
    "    if i < 5:\n",
    "        print(\"Prediction: \",predictions[i],\", Actual: \",y_test[i])\n",
    "    \n",
    "    if predictions[i] == y_test[i]:\n",
    "        correct_ones = correct_ones + 1\n",
    "    \n",
    "    instances = instances + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2377\n",
      "3589\n"
     ]
    }
   ],
   "source": [
    "print(\"correctly classified ones after training: \",correct_ones)\n",
    "print(\"total number of instances in the test set: \",instances)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Confusion Matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [],
   "source": [
    "from sklearn.metrics import classification_report, confusion_matrix"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([[233,   9,  49,  23,  90,  11,  52],\n",
       "       [ 12,  31,   1,   2,   5,   0,   5],\n",
       "       [ 30,   3, 189,  21, 130,  41,  82],\n",
       "       [  7,   1,  11, 778,  22,  17,  59],\n",
       "       [ 35,   4,  51,  24, 391,   9, 139],\n",
       "       [  8,   1,  20,  18,  13, 333,  22],\n",
       "       [ 13,   1,  29,  49,  90,   3, 422]])"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "confusion_matrix(y_test, predictions)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Exporting"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.export_autokeras_model('autokeras_model.h5')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [],
   "source": [
    "model.export_keras_model('keras_model.h5')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Auto-Keras Model Restoration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [],
   "source": [
    "from autokeras.utils import pickle_from_file"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {},
   "outputs": [],
   "source": [
    "autokeras_model = pickle_from_file(\"autokeras_model.h5\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.6623014767344664\n"
     ]
    }
   ],
   "source": [
    "autokeras_score = autokeras_model.evaluate(x_test, y_test)\n",
    "print(autokeras_score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [],
   "source": [
    "autokeras_predictions = autokeras_model.predict(x_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Prediction:  2.0 , Actual:  0.0\n",
      "Prediction:  1.0 , Actual:  1.0\n",
      "Prediction:  0.0 , Actual:  4.0\n",
      "Prediction:  2.0 , Actual:  6.0\n",
      "Prediction:  3.0 , Actual:  3.0\n"
     ]
    }
   ],
   "source": [
    "instances = 0\n",
    "correct_ones = 0\n",
    "\n",
    "for i in range(0, len(autokeras_predictions)):\n",
    "    if i < 5:\n",
    "        print(\"Prediction: \",autokeras_predictions[i],\", Actual: \",y_test[i])\n",
    "    \n",
    "    if autokeras_predictions[i] == y_test[i]:\n",
    "        correct_ones = correct_ones + 1\n",
    "    \n",
    "    instances = instances + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.6623014767344664"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#this must be equal to autokeras_score\n",
    "autokeras_score == correct_ones/instances"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Keras Model Restoration"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "from keras.models import load_model"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/workspaces/sefik/.local/lib/python3.6/site-packages/keras/engine/saving.py:292: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.\n",
      "  warnings.warn('No training configuration found in save file: '\n"
     ]
    }
   ],
   "source": [
    "keras_model = load_model('keras_model.h5') "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "226654"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "model_config = keras_model.to_json()\n",
    "open(\"fer_autokeras_keras_model.json\", \"w\").write(model_config)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "input_2 (InputLayer)            (None, 48, 48, 1)    0                                            \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_125 (Conv2D)             (None, 48, 48, 64)   3200        input_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_122 (BatchN (None, 48, 48, 64)   256         conv2d_125[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_126 (Activation)     (None, 48, 48, 64)   0           batch_normalization_122[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_9 (MaxPooling2D)  (None, 24, 24, 64)   0           activation_126[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_123 (BatchN (None, 24, 24, 64)   256         max_pooling2d_9[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_127 (Activation)     (None, 24, 24, 64)   0           batch_normalization_123[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_126 (Conv2D)             (None, 24, 24, 128)  8320        activation_127[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_124 (BatchN (None, 24, 24, 128)  512         conv2d_126[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_128 (Activation)     (None, 24, 24, 128)  0           batch_normalization_124[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_127 (Conv2D)             (None, 24, 24, 32)   36896       activation_128[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_59 (SpatialDr (None, 24, 24, 32)   0           conv2d_127[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_59 (Concatenate)    (None, 24, 24, 96)   0           max_pooling2d_9[0][0]            \n",
      "                                                                 spatial_dropout2d_59[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_125 (BatchN (None, 24, 24, 96)   384         concatenate_59[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_129 (Activation)     (None, 24, 24, 96)   0           batch_normalization_125[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_128 (Conv2D)             (None, 24, 24, 128)  12416       activation_129[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_126 (BatchN (None, 24, 24, 128)  512         conv2d_128[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_130 (Activation)     (None, 24, 24, 128)  0           batch_normalization_126[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_129 (Conv2D)             (None, 24, 24, 32)   36896       activation_130[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_60 (SpatialDr (None, 24, 24, 32)   0           conv2d_129[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_60 (Concatenate)    (None, 24, 24, 128)  0           concatenate_59[0][0]             \n",
      "                                                                 spatial_dropout2d_60[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_127 (BatchN (None, 24, 24, 128)  512         concatenate_60[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_131 (Activation)     (None, 24, 24, 128)  0           batch_normalization_127[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_130 (Conv2D)             (None, 24, 24, 128)  16512       activation_131[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_128 (BatchN (None, 24, 24, 128)  512         conv2d_130[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_132 (Activation)     (None, 24, 24, 128)  0           batch_normalization_128[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_131 (Conv2D)             (None, 24, 24, 32)   36896       activation_132[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_61 (SpatialDr (None, 24, 24, 32)   0           conv2d_131[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_61 (Concatenate)    (None, 24, 24, 160)  0           concatenate_60[0][0]             \n",
      "                                                                 spatial_dropout2d_61[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_129 (BatchN (None, 24, 24, 160)  640         concatenate_61[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_133 (Activation)     (None, 24, 24, 160)  0           batch_normalization_129[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_132 (Conv2D)             (None, 24, 24, 128)  20608       activation_133[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_130 (BatchN (None, 24, 24, 128)  512         conv2d_132[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_134 (Activation)     (None, 24, 24, 128)  0           batch_normalization_130[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_133 (Conv2D)             (None, 24, 24, 32)   36896       activation_134[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_62 (SpatialDr (None, 24, 24, 32)   0           conv2d_133[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_62 (Concatenate)    (None, 24, 24, 192)  0           concatenate_61[0][0]             \n",
      "                                                                 spatial_dropout2d_62[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_131 (BatchN (None, 24, 24, 192)  768         concatenate_62[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_135 (Activation)     (None, 24, 24, 192)  0           batch_normalization_131[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_134 (Conv2D)             (None, 24, 24, 128)  24704       activation_135[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_132 (BatchN (None, 24, 24, 128)  512         conv2d_134[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_136 (Activation)     (None, 24, 24, 128)  0           batch_normalization_132[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_135 (Conv2D)             (None, 24, 24, 32)   36896       activation_136[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_63 (SpatialDr (None, 24, 24, 32)   0           conv2d_135[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_63 (Concatenate)    (None, 24, 24, 224)  0           concatenate_62[0][0]             \n",
      "                                                                 spatial_dropout2d_63[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_133 (BatchN (None, 24, 24, 224)  896         concatenate_63[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_137 (Activation)     (None, 24, 24, 224)  0           batch_normalization_133[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_136 (Conv2D)             (None, 24, 24, 128)  28800       activation_137[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_134 (BatchN (None, 24, 24, 128)  512         conv2d_136[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_138 (Activation)     (None, 24, 24, 128)  0           batch_normalization_134[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_137 (Conv2D)             (None, 24, 24, 32)   36896       activation_138[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_64 (SpatialDr (None, 24, 24, 32)   0           conv2d_137[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_64 (Concatenate)    (None, 24, 24, 256)  0           concatenate_63[0][0]             \n",
      "                                                                 spatial_dropout2d_64[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_135 (BatchN (None, 24, 24, 256)  1024        concatenate_64[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_139 (Activation)     (None, 24, 24, 256)  0           batch_normalization_135[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_138 (Conv2D)             (None, 24, 24, 128)  32896       activation_139[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_10 (MaxPooling2D) (None, 12, 12, 128)  0           conv2d_138[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_136 (BatchN (None, 12, 12, 128)  512         max_pooling2d_10[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "activation_140 (Activation)     (None, 12, 12, 128)  0           batch_normalization_136[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_139 (Conv2D)             (None, 12, 12, 128)  16512       activation_140[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_137 (BatchN (None, 12, 12, 128)  512         conv2d_139[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_141 (Activation)     (None, 12, 12, 128)  0           batch_normalization_137[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_140 (Conv2D)             (None, 12, 12, 32)   36896       activation_141[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_65 (SpatialDr (None, 12, 12, 32)   0           conv2d_140[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_65 (Concatenate)    (None, 12, 12, 160)  0           max_pooling2d_10[0][0]           \n",
      "                                                                 spatial_dropout2d_65[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_138 (BatchN (None, 12, 12, 160)  640         concatenate_65[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_142 (Activation)     (None, 12, 12, 160)  0           batch_normalization_138[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_141 (Conv2D)             (None, 12, 12, 128)  20608       activation_142[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_139 (BatchN (None, 12, 12, 128)  512         conv2d_141[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_143 (Activation)     (None, 12, 12, 128)  0           batch_normalization_139[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_142 (Conv2D)             (None, 12, 12, 32)   36896       activation_143[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_66 (SpatialDr (None, 12, 12, 32)   0           conv2d_142[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_66 (Concatenate)    (None, 12, 12, 192)  0           concatenate_65[0][0]             \n",
      "                                                                 spatial_dropout2d_66[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_140 (BatchN (None, 12, 12, 192)  768         concatenate_66[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_144 (Activation)     (None, 12, 12, 192)  0           batch_normalization_140[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_143 (Conv2D)             (None, 12, 12, 128)  24704       activation_144[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_141 (BatchN (None, 12, 12, 128)  512         conv2d_143[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_145 (Activation)     (None, 12, 12, 128)  0           batch_normalization_141[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_144 (Conv2D)             (None, 12, 12, 32)   36896       activation_145[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_67 (SpatialDr (None, 12, 12, 32)   0           conv2d_144[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_67 (Concatenate)    (None, 12, 12, 224)  0           concatenate_66[0][0]             \n",
      "                                                                 spatial_dropout2d_67[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_142 (BatchN (None, 12, 12, 224)  896         concatenate_67[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_146 (Activation)     (None, 12, 12, 224)  0           batch_normalization_142[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_145 (Conv2D)             (None, 12, 12, 128)  28800       activation_146[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_143 (BatchN (None, 12, 12, 128)  512         conv2d_145[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_147 (Activation)     (None, 12, 12, 128)  0           batch_normalization_143[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_146 (Conv2D)             (None, 12, 12, 32)   36896       activation_147[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_68 (SpatialDr (None, 12, 12, 32)   0           conv2d_146[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_68 (Concatenate)    (None, 12, 12, 256)  0           concatenate_67[0][0]             \n",
      "                                                                 spatial_dropout2d_68[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_144 (BatchN (None, 12, 12, 256)  1024        concatenate_68[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_148 (Activation)     (None, 12, 12, 256)  0           batch_normalization_144[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_147 (Conv2D)             (None, 12, 12, 128)  32896       activation_148[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_145 (BatchN (None, 12, 12, 128)  512         conv2d_147[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_149 (Activation)     (None, 12, 12, 128)  0           batch_normalization_145[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_148 (Conv2D)             (None, 12, 12, 32)   36896       activation_149[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_69 (SpatialDr (None, 12, 12, 32)   0           conv2d_148[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_69 (Concatenate)    (None, 12, 12, 288)  0           concatenate_68[0][0]             \n",
      "                                                                 spatial_dropout2d_69[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_146 (BatchN (None, 12, 12, 288)  1152        concatenate_69[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_150 (Activation)     (None, 12, 12, 288)  0           batch_normalization_146[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_149 (Conv2D)             (None, 12, 12, 128)  36992       activation_150[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_147 (BatchN (None, 12, 12, 128)  512         conv2d_149[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_151 (Activation)     (None, 12, 12, 128)  0           batch_normalization_147[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_150 (Conv2D)             (None, 12, 12, 32)   36896       activation_151[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_70 (SpatialDr (None, 12, 12, 32)   0           conv2d_150[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_70 (Concatenate)    (None, 12, 12, 320)  0           concatenate_69[0][0]             \n",
      "                                                                 spatial_dropout2d_70[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_148 (BatchN (None, 12, 12, 320)  1280        concatenate_70[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_152 (Activation)     (None, 12, 12, 320)  0           batch_normalization_148[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_151 (Conv2D)             (None, 12, 12, 128)  41088       activation_152[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_149 (BatchN (None, 12, 12, 128)  512         conv2d_151[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_153 (Activation)     (None, 12, 12, 128)  0           batch_normalization_149[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_152 (Conv2D)             (None, 12, 12, 32)   36896       activation_153[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_71 (SpatialDr (None, 12, 12, 32)   0           conv2d_152[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_71 (Concatenate)    (None, 12, 12, 352)  0           concatenate_70[0][0]             \n",
      "                                                                 spatial_dropout2d_71[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_150 (BatchN (None, 12, 12, 352)  1408        concatenate_71[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_154 (Activation)     (None, 12, 12, 352)  0           batch_normalization_150[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_153 (Conv2D)             (None, 12, 12, 128)  45184       activation_154[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_151 (BatchN (None, 12, 12, 128)  512         conv2d_153[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_155 (Activation)     (None, 12, 12, 128)  0           batch_normalization_151[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_154 (Conv2D)             (None, 12, 12, 32)   36896       activation_155[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_72 (SpatialDr (None, 12, 12, 32)   0           conv2d_154[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_72 (Concatenate)    (None, 12, 12, 384)  0           concatenate_71[0][0]             \n",
      "                                                                 spatial_dropout2d_72[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_152 (BatchN (None, 12, 12, 384)  1536        concatenate_72[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_156 (Activation)     (None, 12, 12, 384)  0           batch_normalization_152[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_155 (Conv2D)             (None, 12, 12, 128)  49280       activation_156[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_153 (BatchN (None, 12, 12, 128)  512         conv2d_155[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_157 (Activation)     (None, 12, 12, 128)  0           batch_normalization_153[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_156 (Conv2D)             (None, 12, 12, 32)   36896       activation_157[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_73 (SpatialDr (None, 12, 12, 32)   0           conv2d_156[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_73 (Concatenate)    (None, 12, 12, 416)  0           concatenate_72[0][0]             \n",
      "                                                                 spatial_dropout2d_73[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_154 (BatchN (None, 12, 12, 416)  1664        concatenate_73[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_158 (Activation)     (None, 12, 12, 416)  0           batch_normalization_154[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_157 (Conv2D)             (None, 12, 12, 128)  53376       activation_158[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_155 (BatchN (None, 12, 12, 128)  512         conv2d_157[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_159 (Activation)     (None, 12, 12, 128)  0           batch_normalization_155[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_158 (Conv2D)             (None, 12, 12, 32)   36896       activation_159[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_74 (SpatialDr (None, 12, 12, 32)   0           conv2d_158[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_74 (Concatenate)    (None, 12, 12, 448)  0           concatenate_73[0][0]             \n",
      "                                                                 spatial_dropout2d_74[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_156 (BatchN (None, 12, 12, 448)  1792        concatenate_74[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_160 (Activation)     (None, 12, 12, 448)  0           batch_normalization_156[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_159 (Conv2D)             (None, 12, 12, 128)  57472       activation_160[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_157 (BatchN (None, 12, 12, 128)  512         conv2d_159[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_161 (Activation)     (None, 12, 12, 128)  0           batch_normalization_157[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_160 (Conv2D)             (None, 12, 12, 32)   36896       activation_161[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_75 (SpatialDr (None, 12, 12, 32)   0           conv2d_160[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_75 (Concatenate)    (None, 12, 12, 480)  0           concatenate_74[0][0]             \n",
      "                                                                 spatial_dropout2d_75[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_158 (BatchN (None, 12, 12, 480)  1920        concatenate_75[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_162 (Activation)     (None, 12, 12, 480)  0           batch_normalization_158[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_161 (Conv2D)             (None, 12, 12, 128)  61568       activation_162[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_159 (BatchN (None, 12, 12, 128)  512         conv2d_161[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_163 (Activation)     (None, 12, 12, 128)  0           batch_normalization_159[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_162 (Conv2D)             (None, 12, 12, 32)   36896       activation_163[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_76 (SpatialDr (None, 12, 12, 32)   0           conv2d_162[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_76 (Concatenate)    (None, 12, 12, 512)  0           concatenate_75[0][0]             \n",
      "                                                                 spatial_dropout2d_76[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_160 (BatchN (None, 12, 12, 512)  2048        concatenate_76[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_164 (Activation)     (None, 12, 12, 512)  0           batch_normalization_160[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_163 (Conv2D)             (None, 12, 12, 256)  131328      activation_164[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_11 (MaxPooling2D) (None, 6, 6, 256)    0           conv2d_163[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_161 (BatchN (None, 6, 6, 256)    1024        max_pooling2d_11[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "activation_165 (Activation)     (None, 6, 6, 256)    0           batch_normalization_161[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_164 (Conv2D)             (None, 6, 6, 128)    32896       activation_165[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_162 (BatchN (None, 6, 6, 128)    512         conv2d_164[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_166 (Activation)     (None, 6, 6, 128)    0           batch_normalization_162[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_165 (Conv2D)             (None, 6, 6, 32)     36896       activation_166[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_77 (SpatialDr (None, 6, 6, 32)     0           conv2d_165[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_77 (Concatenate)    (None, 6, 6, 288)    0           max_pooling2d_11[0][0]           \n",
      "                                                                 spatial_dropout2d_77[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_163 (BatchN (None, 6, 6, 288)    1152        concatenate_77[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_167 (Activation)     (None, 6, 6, 288)    0           batch_normalization_163[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_166 (Conv2D)             (None, 6, 6, 128)    36992       activation_167[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_164 (BatchN (None, 6, 6, 128)    512         conv2d_166[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_168 (Activation)     (None, 6, 6, 128)    0           batch_normalization_164[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_167 (Conv2D)             (None, 6, 6, 32)     36896       activation_168[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_78 (SpatialDr (None, 6, 6, 32)     0           conv2d_167[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_78 (Concatenate)    (None, 6, 6, 320)    0           concatenate_77[0][0]             \n",
      "                                                                 spatial_dropout2d_78[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_165 (BatchN (None, 6, 6, 320)    1280        concatenate_78[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_169 (Activation)     (None, 6, 6, 320)    0           batch_normalization_165[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_168 (Conv2D)             (None, 6, 6, 128)    41088       activation_169[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_166 (BatchN (None, 6, 6, 128)    512         conv2d_168[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_170 (Activation)     (None, 6, 6, 128)    0           batch_normalization_166[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_169 (Conv2D)             (None, 6, 6, 32)     36896       activation_170[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_79 (SpatialDr (None, 6, 6, 32)     0           conv2d_169[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_79 (Concatenate)    (None, 6, 6, 352)    0           concatenate_78[0][0]             \n",
      "                                                                 spatial_dropout2d_79[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_167 (BatchN (None, 6, 6, 352)    1408        concatenate_79[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_171 (Activation)     (None, 6, 6, 352)    0           batch_normalization_167[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_170 (Conv2D)             (None, 6, 6, 128)    45184       activation_171[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_168 (BatchN (None, 6, 6, 128)    512         conv2d_170[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_172 (Activation)     (None, 6, 6, 128)    0           batch_normalization_168[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_171 (Conv2D)             (None, 6, 6, 32)     36896       activation_172[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_80 (SpatialDr (None, 6, 6, 32)     0           conv2d_171[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_80 (Concatenate)    (None, 6, 6, 384)    0           concatenate_79[0][0]             \n",
      "                                                                 spatial_dropout2d_80[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_169 (BatchN (None, 6, 6, 384)    1536        concatenate_80[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_173 (Activation)     (None, 6, 6, 384)    0           batch_normalization_169[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_172 (Conv2D)             (None, 6, 6, 128)    49280       activation_173[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_170 (BatchN (None, 6, 6, 128)    512         conv2d_172[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_174 (Activation)     (None, 6, 6, 128)    0           batch_normalization_170[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_173 (Conv2D)             (None, 6, 6, 32)     36896       activation_174[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_81 (SpatialDr (None, 6, 6, 32)     0           conv2d_173[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_81 (Concatenate)    (None, 6, 6, 416)    0           concatenate_80[0][0]             \n",
      "                                                                 spatial_dropout2d_81[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_171 (BatchN (None, 6, 6, 416)    1664        concatenate_81[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_175 (Activation)     (None, 6, 6, 416)    0           batch_normalization_171[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_174 (Conv2D)             (None, 6, 6, 128)    53376       activation_175[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_172 (BatchN (None, 6, 6, 128)    512         conv2d_174[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_176 (Activation)     (None, 6, 6, 128)    0           batch_normalization_172[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_175 (Conv2D)             (None, 6, 6, 32)     36896       activation_176[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_82 (SpatialDr (None, 6, 6, 32)     0           conv2d_175[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_82 (Concatenate)    (None, 6, 6, 448)    0           concatenate_81[0][0]             \n",
      "                                                                 spatial_dropout2d_82[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_173 (BatchN (None, 6, 6, 448)    1792        concatenate_82[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_177 (Activation)     (None, 6, 6, 448)    0           batch_normalization_173[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_176 (Conv2D)             (None, 6, 6, 128)    57472       activation_177[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_174 (BatchN (None, 6, 6, 128)    512         conv2d_176[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_178 (Activation)     (None, 6, 6, 128)    0           batch_normalization_174[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_177 (Conv2D)             (None, 6, 6, 32)     36896       activation_178[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_83 (SpatialDr (None, 6, 6, 32)     0           conv2d_177[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_83 (Concatenate)    (None, 6, 6, 480)    0           concatenate_82[0][0]             \n",
      "                                                                 spatial_dropout2d_83[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_175 (BatchN (None, 6, 6, 480)    1920        concatenate_83[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_179 (Activation)     (None, 6, 6, 480)    0           batch_normalization_175[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_178 (Conv2D)             (None, 6, 6, 128)    61568       activation_179[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_176 (BatchN (None, 6, 6, 128)    512         conv2d_178[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_180 (Activation)     (None, 6, 6, 128)    0           batch_normalization_176[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_179 (Conv2D)             (None, 6, 6, 32)     36896       activation_180[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_84 (SpatialDr (None, 6, 6, 32)     0           conv2d_179[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_84 (Concatenate)    (None, 6, 6, 512)    0           concatenate_83[0][0]             \n",
      "                                                                 spatial_dropout2d_84[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_177 (BatchN (None, 6, 6, 512)    2048        concatenate_84[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_181 (Activation)     (None, 6, 6, 512)    0           batch_normalization_177[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_180 (Conv2D)             (None, 6, 6, 128)    65664       activation_181[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_178 (BatchN (None, 6, 6, 128)    512         conv2d_180[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_182 (Activation)     (None, 6, 6, 128)    0           batch_normalization_178[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_181 (Conv2D)             (None, 6, 6, 32)     36896       activation_182[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_85 (SpatialDr (None, 6, 6, 32)     0           conv2d_181[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_85 (Concatenate)    (None, 6, 6, 544)    0           concatenate_84[0][0]             \n",
      "                                                                 spatial_dropout2d_85[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_179 (BatchN (None, 6, 6, 544)    2176        concatenate_85[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_183 (Activation)     (None, 6, 6, 544)    0           batch_normalization_179[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_182 (Conv2D)             (None, 6, 6, 128)    69760       activation_183[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_180 (BatchN (None, 6, 6, 128)    512         conv2d_182[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_184 (Activation)     (None, 6, 6, 128)    0           batch_normalization_180[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_183 (Conv2D)             (None, 6, 6, 32)     36896       activation_184[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_86 (SpatialDr (None, 6, 6, 32)     0           conv2d_183[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_86 (Concatenate)    (None, 6, 6, 576)    0           concatenate_85[0][0]             \n",
      "                                                                 spatial_dropout2d_86[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_181 (BatchN (None, 6, 6, 576)    2304        concatenate_86[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_185 (Activation)     (None, 6, 6, 576)    0           batch_normalization_181[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_184 (Conv2D)             (None, 6, 6, 128)    73856       activation_185[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_182 (BatchN (None, 6, 6, 128)    512         conv2d_184[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_186 (Activation)     (None, 6, 6, 128)    0           batch_normalization_182[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_185 (Conv2D)             (None, 6, 6, 32)     36896       activation_186[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_87 (SpatialDr (None, 6, 6, 32)     0           conv2d_185[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_87 (Concatenate)    (None, 6, 6, 608)    0           concatenate_86[0][0]             \n",
      "                                                                 spatial_dropout2d_87[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_183 (BatchN (None, 6, 6, 608)    2432        concatenate_87[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_187 (Activation)     (None, 6, 6, 608)    0           batch_normalization_183[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_186 (Conv2D)             (None, 6, 6, 128)    77952       activation_187[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_184 (BatchN (None, 6, 6, 128)    512         conv2d_186[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_188 (Activation)     (None, 6, 6, 128)    0           batch_normalization_184[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_187 (Conv2D)             (None, 6, 6, 32)     36896       activation_188[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_88 (SpatialDr (None, 6, 6, 32)     0           conv2d_187[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_88 (Concatenate)    (None, 6, 6, 640)    0           concatenate_87[0][0]             \n",
      "                                                                 spatial_dropout2d_88[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_185 (BatchN (None, 6, 6, 640)    2560        concatenate_88[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_189 (Activation)     (None, 6, 6, 640)    0           batch_normalization_185[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_188 (Conv2D)             (None, 6, 6, 128)    82048       activation_189[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_186 (BatchN (None, 6, 6, 128)    512         conv2d_188[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_190 (Activation)     (None, 6, 6, 128)    0           batch_normalization_186[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_189 (Conv2D)             (None, 6, 6, 32)     36896       activation_190[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_89 (SpatialDr (None, 6, 6, 32)     0           conv2d_189[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_89 (Concatenate)    (None, 6, 6, 672)    0           concatenate_88[0][0]             \n",
      "                                                                 spatial_dropout2d_89[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_187 (BatchN (None, 6, 6, 672)    2688        concatenate_89[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_15 (MaxPooling2D) (None, 12, 12, 128)  0           batch_normalization_132[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "activation_191 (Activation)     (None, 6, 6, 672)    0           batch_normalization_187[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_16 (MaxPooling2D) (None, 6, 6, 128)    0           max_pooling2d_15[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_190 (Conv2D)             (None, 6, 6, 128)    86144       activation_191[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_250 (Activation)     (None, 6, 6, 128)    0           max_pooling2d_16[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_188 (BatchN (None, 6, 6, 128)    512         conv2d_190[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_248 (Conv2D)             (None, 6, 6, 128)    16512       activation_250[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "add_8 (Add)                     (None, 6, 6, 128)    0           batch_normalization_188[0][0]    \n",
      "                                                                 conv2d_248[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_192 (Activation)     (None, 6, 6, 128)    0           add_8[0][0]                      \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_191 (Conv2D)             (None, 6, 6, 32)     36896       activation_192[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_90 (SpatialDr (None, 6, 6, 32)     0           conv2d_191[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_90 (Concatenate)    (None, 6, 6, 704)    0           concatenate_89[0][0]             \n",
      "                                                                 spatial_dropout2d_90[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_189 (BatchN (None, 6, 6, 704)    2816        concatenate_90[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_193 (Activation)     (None, 6, 6, 704)    0           batch_normalization_189[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_192 (Conv2D)             (None, 6, 6, 128)    90240       activation_193[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_190 (BatchN (None, 6, 6, 128)    512         conv2d_192[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_194 (Activation)     (None, 6, 6, 128)    0           batch_normalization_190[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_193 (Conv2D)             (None, 6, 6, 32)     36896       activation_194[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_91 (SpatialDr (None, 6, 6, 32)     0           conv2d_193[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_91 (Concatenate)    (None, 6, 6, 736)    0           concatenate_90[0][0]             \n",
      "                                                                 spatial_dropout2d_91[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_191 (BatchN (None, 6, 6, 736)    2944        concatenate_91[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_195 (Activation)     (None, 6, 6, 736)    0           batch_normalization_191[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_194 (Conv2D)             (None, 6, 6, 128)    94336       activation_195[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_192 (BatchN (None, 6, 6, 128)    512         conv2d_194[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_196 (Activation)     (None, 6, 6, 128)    0           batch_normalization_192[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_195 (Conv2D)             (None, 6, 6, 32)     36896       activation_196[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_92 (SpatialDr (None, 6, 6, 32)     0           conv2d_195[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_92 (Concatenate)    (None, 6, 6, 768)    0           concatenate_91[0][0]             \n",
      "                                                                 spatial_dropout2d_92[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_193 (BatchN (None, 6, 6, 768)    3072        concatenate_92[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_197 (Activation)     (None, 6, 6, 768)    0           batch_normalization_193[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_196 (Conv2D)             (None, 6, 6, 128)    98432       activation_197[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_194 (BatchN (None, 6, 6, 128)    512         conv2d_196[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_198 (Activation)     (None, 6, 6, 128)    0           batch_normalization_194[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_197 (Conv2D)             (None, 6, 6, 32)     36896       activation_198[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_93 (SpatialDr (None, 6, 6, 32)     0           conv2d_197[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_93 (Concatenate)    (None, 6, 6, 800)    0           concatenate_92[0][0]             \n",
      "                                                                 spatial_dropout2d_93[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_195 (BatchN (None, 6, 6, 800)    3200        concatenate_93[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_199 (Activation)     (None, 6, 6, 800)    0           batch_normalization_195[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_198 (Conv2D)             (None, 6, 6, 128)    102528      activation_199[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_196 (BatchN (None, 6, 6, 128)    512         conv2d_198[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_200 (Activation)     (None, 6, 6, 128)    0           batch_normalization_196[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_199 (Conv2D)             (None, 6, 6, 32)     36896       activation_200[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_94 (SpatialDr (None, 6, 6, 32)     0           conv2d_199[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_94 (Concatenate)    (None, 6, 6, 832)    0           concatenate_93[0][0]             \n",
      "                                                                 spatial_dropout2d_94[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_197 (BatchN (None, 6, 6, 832)    3328        concatenate_94[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_201 (Activation)     (None, 6, 6, 832)    0           batch_normalization_197[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_200 (Conv2D)             (None, 6, 6, 128)    106624      activation_201[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_198 (BatchN (None, 6, 6, 128)    512         conv2d_200[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_202 (Activation)     (None, 6, 6, 128)    0           batch_normalization_198[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_201 (Conv2D)             (None, 6, 6, 32)     36896       activation_202[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_95 (SpatialDr (None, 6, 6, 32)     0           conv2d_201[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_95 (Concatenate)    (None, 6, 6, 864)    0           concatenate_94[0][0]             \n",
      "                                                                 spatial_dropout2d_95[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_199 (BatchN (None, 6, 6, 864)    3456        concatenate_95[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_203 (Activation)     (None, 6, 6, 864)    0           batch_normalization_199[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_202 (Conv2D)             (None, 6, 6, 128)    110720      activation_203[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_200 (BatchN (None, 6, 6, 128)    512         conv2d_202[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_204 (Activation)     (None, 6, 6, 128)    0           batch_normalization_200[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_203 (Conv2D)             (None, 6, 6, 32)     36896       activation_204[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_96 (SpatialDr (None, 6, 6, 32)     0           conv2d_203[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_96 (Concatenate)    (None, 6, 6, 896)    0           concatenate_95[0][0]             \n",
      "                                                                 spatial_dropout2d_96[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_201 (BatchN (None, 6, 6, 896)    3584        concatenate_96[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_205 (Activation)     (None, 6, 6, 896)    0           batch_normalization_201[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_204 (Conv2D)             (None, 6, 6, 128)    114816      activation_205[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_202 (BatchN (None, 6, 6, 128)    512         conv2d_204[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_206 (Activation)     (None, 6, 6, 128)    0           batch_normalization_202[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_205 (Conv2D)             (None, 6, 6, 32)     36896       activation_206[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_97 (SpatialDr (None, 6, 6, 32)     0           conv2d_205[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_97 (Concatenate)    (None, 6, 6, 928)    0           concatenate_96[0][0]             \n",
      "                                                                 spatial_dropout2d_97[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_203 (BatchN (None, 6, 6, 928)    3712        concatenate_97[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_207 (Activation)     (None, 6, 6, 928)    0           batch_normalization_203[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_206 (Conv2D)             (None, 6, 6, 128)    118912      activation_207[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_204 (BatchN (None, 6, 6, 128)    512         conv2d_206[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_208 (Activation)     (None, 6, 6, 128)    0           batch_normalization_204[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_207 (Conv2D)             (None, 6, 6, 32)     36896       activation_208[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_98 (SpatialDr (None, 6, 6, 32)     0           conv2d_207[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_98 (Concatenate)    (None, 6, 6, 960)    0           concatenate_97[0][0]             \n",
      "                                                                 spatial_dropout2d_98[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_205 (BatchN (None, 6, 6, 960)    3840        concatenate_98[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_209 (Activation)     (None, 6, 6, 960)    0           batch_normalization_205[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_208 (Conv2D)             (None, 6, 6, 128)    123008      activation_209[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_206 (BatchN (None, 6, 6, 128)    512         conv2d_208[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_210 (Activation)     (None, 6, 6, 128)    0           batch_normalization_206[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_209 (Conv2D)             (None, 6, 6, 32)     36896       activation_210[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_99 (SpatialDr (None, 6, 6, 32)     0           conv2d_209[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_99 (Concatenate)    (None, 6, 6, 992)    0           concatenate_98[0][0]             \n",
      "                                                                 spatial_dropout2d_99[0][0]       \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_207 (BatchN (None, 6, 6, 992)    3968        concatenate_99[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_211 (Activation)     (None, 6, 6, 992)    0           batch_normalization_207[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_210 (Conv2D)             (None, 6, 6, 128)    127104      activation_211[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_208 (BatchN (None, 6, 6, 128)    512         conv2d_210[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_212 (Activation)     (None, 6, 6, 128)    0           batch_normalization_208[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_211 (Conv2D)             (None, 6, 6, 32)     36896       activation_212[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_100 (SpatialD (None, 6, 6, 32)     0           conv2d_211[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_100 (Concatenate)   (None, 6, 6, 1024)   0           concatenate_99[0][0]             \n",
      "                                                                 spatial_dropout2d_100[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_209 (BatchN (None, 6, 6, 1024)   4096        concatenate_100[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_213 (Activation)     (None, 6, 6, 1024)   0           batch_normalization_209[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_212 (Conv2D)             (None, 6, 6, 512)    524800      activation_213[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_12 (MaxPooling2D) (None, 3, 3, 512)    0           conv2d_212[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_210 (BatchN (None, 3, 3, 512)    2048        max_pooling2d_12[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "activation_214 (Activation)     (None, 3, 3, 512)    0           batch_normalization_210[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_213 (Conv2D)             (None, 3, 3, 128)    65664       activation_214[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_211 (BatchN (None, 3, 3, 128)    512         conv2d_213[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_215 (Activation)     (None, 3, 3, 128)    0           batch_normalization_211[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_214 (Conv2D)             (None, 3, 3, 32)     36896       activation_215[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_101 (SpatialD (None, 3, 3, 32)     0           conv2d_214[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_101 (Concatenate)   (None, 3, 3, 544)    0           max_pooling2d_12[0][0]           \n",
      "                                                                 spatial_dropout2d_101[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_212 (BatchN (None, 3, 3, 544)    2176        concatenate_101[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_216 (Activation)     (None, 3, 3, 544)    0           batch_normalization_212[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_215 (Conv2D)             (None, 3, 3, 128)    69760       activation_216[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_213 (BatchN (None, 3, 3, 128)    512         conv2d_215[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_217 (Activation)     (None, 3, 3, 128)    0           batch_normalization_213[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_216 (Conv2D)             (None, 3, 3, 32)     36896       activation_217[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_102 (SpatialD (None, 3, 3, 32)     0           conv2d_216[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_102 (Concatenate)   (None, 3, 3, 576)    0           concatenate_101[0][0]            \n",
      "                                                                 spatial_dropout2d_102[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_214 (BatchN (None, 3, 3, 576)    2304        concatenate_102[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_218 (Activation)     (None, 3, 3, 576)    0           batch_normalization_214[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_217 (Conv2D)             (None, 3, 3, 128)    73856       activation_218[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_215 (BatchN (None, 3, 3, 128)    512         conv2d_217[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_219 (Activation)     (None, 3, 3, 128)    0           batch_normalization_215[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_218 (Conv2D)             (None, 3, 3, 32)     36896       activation_219[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_103 (SpatialD (None, 3, 3, 32)     0           conv2d_218[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_103 (Concatenate)   (None, 3, 3, 608)    0           concatenate_102[0][0]            \n",
      "                                                                 spatial_dropout2d_103[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_216 (BatchN (None, 3, 3, 608)    2432        concatenate_103[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_220 (Activation)     (None, 3, 3, 608)    0           batch_normalization_216[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_219 (Conv2D)             (None, 3, 3, 128)    77952       activation_220[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_217 (BatchN (None, 3, 3, 128)    512         conv2d_219[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_221 (Activation)     (None, 3, 3, 128)    0           batch_normalization_217[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_220 (Conv2D)             (None, 3, 3, 32)     36896       activation_221[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_104 (SpatialD (None, 3, 3, 32)     0           conv2d_220[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_104 (Concatenate)   (None, 3, 3, 640)    0           concatenate_103[0][0]            \n",
      "                                                                 spatial_dropout2d_104[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_218 (BatchN (None, 3, 3, 640)    2560        concatenate_104[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_222 (Activation)     (None, 3, 3, 640)    0           batch_normalization_218[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_221 (Conv2D)             (None, 3, 3, 128)    82048       activation_222[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_219 (BatchN (None, 3, 3, 128)    512         conv2d_221[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_223 (Activation)     (None, 3, 3, 128)    0           batch_normalization_219[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_222 (Conv2D)             (None, 3, 3, 32)     36896       activation_223[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_105 (SpatialD (None, 3, 3, 32)     0           conv2d_222[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_105 (Concatenate)   (None, 3, 3, 672)    0           concatenate_104[0][0]            \n",
      "                                                                 spatial_dropout2d_105[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_220 (BatchN (None, 3, 3, 672)    2688        concatenate_105[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_224 (Activation)     (None, 3, 3, 672)    0           batch_normalization_220[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_223 (Conv2D)             (None, 3, 3, 128)    86144       activation_224[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_221 (BatchN (None, 3, 3, 128)    512         conv2d_223[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_225 (Activation)     (None, 3, 3, 128)    0           batch_normalization_221[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_224 (Conv2D)             (None, 3, 3, 32)     36896       activation_225[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_106 (SpatialD (None, 3, 3, 32)     0           conv2d_224[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_106 (Concatenate)   (None, 3, 3, 704)    0           concatenate_105[0][0]            \n",
      "                                                                 spatial_dropout2d_106[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_222 (BatchN (None, 3, 3, 704)    2816        concatenate_106[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_226 (Activation)     (None, 3, 3, 704)    0           batch_normalization_222[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_225 (Conv2D)             (None, 3, 3, 128)    90240       activation_226[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_223 (BatchN (None, 3, 3, 128)    512         conv2d_225[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_227 (Activation)     (None, 3, 3, 128)    0           batch_normalization_223[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_226 (Conv2D)             (None, 3, 3, 32)     36896       activation_227[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "activation_248 (Activation)     (None, 3, 3, 128)    0           conv2d_213[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_107 (SpatialD (None, 3, 3, 32)     0           conv2d_226[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_246 (Conv2D)             (None, 3, 3, 32)     4128        activation_248[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "add_6 (Add)                     (None, 3, 3, 32)     0           spatial_dropout2d_107[0][0]      \n",
      "                                                                 conv2d_246[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_107 (Concatenate)   (None, 3, 3, 736)    0           concatenate_106[0][0]            \n",
      "                                                                 add_6[0][0]                      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_224 (BatchN (None, 3, 3, 736)    2944        concatenate_107[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_249 (Activation)     (None, 3, 3, 128)    0           batch_normalization_219[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "activation_228 (Activation)     (None, 3, 3, 736)    0           batch_normalization_224[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_247 (Conv2D)             (None, 3, 3, 736)    94944       activation_249[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "add_7 (Add)                     (None, 3, 3, 736)    0           activation_228[0][0]             \n",
      "                                                                 conv2d_247[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_227 (Conv2D)             (None, 3, 3, 128)    94336       add_7[0][0]                      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_225 (BatchN (None, 3, 3, 128)    512         conv2d_227[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_229 (Activation)     (None, 3, 3, 128)    0           batch_normalization_225[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_228 (Conv2D)             (None, 3, 3, 32)     36896       activation_229[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_108 (SpatialD (None, 3, 3, 32)     0           conv2d_228[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_108 (Concatenate)   (None, 3, 3, 768)    0           concatenate_107[0][0]            \n",
      "                                                                 spatial_dropout2d_108[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_226 (BatchN (None, 3, 3, 768)    3072        concatenate_108[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_230 (Activation)     (None, 3, 3, 768)    0           batch_normalization_226[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_229 (Conv2D)             (None, 3, 3, 128)    98432       activation_230[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_227 (BatchN (None, 3, 3, 128)    512         conv2d_229[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_231 (Activation)     (None, 3, 3, 128)    0           batch_normalization_227[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_230 (Conv2D)             (None, 3, 3, 32)     36896       activation_231[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_109 (SpatialD (None, 3, 3, 32)     0           conv2d_230[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_109 (Concatenate)   (None, 3, 3, 800)    0           concatenate_108[0][0]            \n",
      "                                                                 spatial_dropout2d_109[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_228 (BatchN (None, 3, 3, 800)    3200        concatenate_109[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_232 (Activation)     (None, 3, 3, 800)    0           batch_normalization_228[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_231 (Conv2D)             (None, 3, 3, 128)    102528      activation_232[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_229 (BatchN (None, 3, 3, 128)    512         conv2d_231[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_233 (Activation)     (None, 3, 3, 128)    0           batch_normalization_229[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_232 (Conv2D)             (None, 3, 3, 32)     36896       activation_233[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_110 (SpatialD (None, 3, 3, 32)     0           conv2d_232[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_110 (Concatenate)   (None, 3, 3, 832)    0           concatenate_109[0][0]            \n",
      "                                                                 spatial_dropout2d_110[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_230 (BatchN (None, 3, 3, 832)    3328        concatenate_110[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_234 (Activation)     (None, 3, 3, 832)    0           batch_normalization_230[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_233 (Conv2D)             (None, 3, 3, 128)    106624      activation_234[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_231 (BatchN (None, 3, 3, 128)    512         conv2d_233[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_235 (Activation)     (None, 3, 3, 128)    0           batch_normalization_231[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_234 (Conv2D)             (None, 3, 3, 32)     36896       activation_235[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_111 (SpatialD (None, 3, 3, 32)     0           conv2d_234[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_111 (Concatenate)   (None, 3, 3, 864)    0           concatenate_110[0][0]            \n",
      "                                                                 spatial_dropout2d_111[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_232 (BatchN (None, 3, 3, 864)    3456        concatenate_111[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_236 (Activation)     (None, 3, 3, 864)    0           batch_normalization_232[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_235 (Conv2D)             (None, 3, 3, 128)    110720      activation_236[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_233 (BatchN (None, 3, 3, 128)    512         conv2d_235[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_237 (Activation)     (None, 3, 3, 128)    0           batch_normalization_233[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_236 (Conv2D)             (None, 3, 3, 32)     36896       activation_237[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_112 (SpatialD (None, 3, 3, 32)     0           conv2d_236[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_112 (Concatenate)   (None, 3, 3, 896)    0           concatenate_111[0][0]            \n",
      "                                                                 spatial_dropout2d_112[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_13 (MaxPooling2D) (None, 6, 6, 352)    0           batch_normalization_150[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_234 (BatchN (None, 3, 3, 896)    3584        concatenate_112[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "max_pooling2d_14 (MaxPooling2D) (None, 3, 3, 352)    0           max_pooling2d_13[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "activation_238 (Activation)     (None, 3, 3, 896)    0           batch_normalization_234[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "activation_247 (Activation)     (None, 3, 3, 352)    0           max_pooling2d_14[0][0]           \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_237 (Conv2D)             (None, 3, 3, 128)    114816      activation_238[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_245 (Conv2D)             (None, 3, 3, 128)    45184       activation_247[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "add_5 (Add)                     (None, 3, 3, 128)    0           conv2d_237[0][0]                 \n",
      "                                                                 conv2d_245[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_235 (BatchN (None, 3, 3, 128)    512         add_5[0][0]                      \n",
      "__________________________________________________________________________________________________\n",
      "activation_239 (Activation)     (None, 3, 3, 128)    0           batch_normalization_235[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_238 (Conv2D)             (None, 3, 3, 32)     36896       activation_239[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_113 (SpatialD (None, 3, 3, 32)     0           conv2d_238[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_113 (Concatenate)   (None, 3, 3, 928)    0           concatenate_112[0][0]            \n",
      "                                                                 spatial_dropout2d_113[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_236 (BatchN (None, 3, 3, 928)    3712        concatenate_113[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_240 (Activation)     (None, 3, 3, 928)    0           batch_normalization_236[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_239 (Conv2D)             (None, 3, 3, 128)    118912      activation_240[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_237 (BatchN (None, 3, 3, 128)    512         conv2d_239[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_241 (Activation)     (None, 3, 3, 128)    0           batch_normalization_237[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_240 (Conv2D)             (None, 3, 3, 32)     36896       activation_241[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_114 (SpatialD (None, 3, 3, 32)     0           conv2d_240[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_114 (Concatenate)   (None, 3, 3, 960)    0           concatenate_113[0][0]            \n",
      "                                                                 spatial_dropout2d_114[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_238 (BatchN (None, 3, 3, 960)    3840        concatenate_114[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_242 (Activation)     (None, 3, 3, 960)    0           batch_normalization_238[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_241 (Conv2D)             (None, 3, 3, 128)    123008      activation_242[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_239 (BatchN (None, 3, 3, 128)    512         conv2d_241[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_243 (Activation)     (None, 3, 3, 128)    0           batch_normalization_239[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_242 (Conv2D)             (None, 3, 3, 32)     36896       activation_243[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_115 (SpatialD (None, 3, 3, 32)     0           conv2d_242[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_115 (Concatenate)   (None, 3, 3, 992)    0           concatenate_114[0][0]            \n",
      "                                                                 spatial_dropout2d_115[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_240 (BatchN (None, 3, 3, 992)    3968        concatenate_115[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_244 (Activation)     (None, 3, 3, 992)    0           batch_normalization_240[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_243 (Conv2D)             (None, 3, 3, 128)    127104      activation_244[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_241 (BatchN (None, 3, 3, 128)    512         conv2d_243[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "activation_245 (Activation)     (None, 3, 3, 128)    0           batch_normalization_241[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_244 (Conv2D)             (None, 3, 3, 32)     36896       activation_245[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "spatial_dropout2d_116 (SpatialD (None, 3, 3, 32)     0           conv2d_244[0][0]                 \n",
      "__________________________________________________________________________________________________\n",
      "concatenate_116 (Concatenate)   (None, 3, 3, 1024)   0           concatenate_115[0][0]            \n",
      "                                                                 spatial_dropout2d_116[0][0]      \n",
      "__________________________________________________________________________________________________\n",
      "batch_normalization_242 (BatchN (None, 3, 3, 1024)   4096        concatenate_116[0][0]            \n",
      "__________________________________________________________________________________________________\n",
      "activation_246 (Activation)     (None, 3, 3, 1024)   0           batch_normalization_242[0][0]    \n",
      "__________________________________________________________________________________________________\n",
      "global_average_pooling2d_2 (Glo (None, 1024)         0           activation_246[0][0]             \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 7)            7175        global_average_pooling2d_2[0][0] \n",
      "==================================================================================================\n",
      "Total params: 7,209,415\n",
      "Trainable params: 7,125,767\n",
      "Non-trainable params: 83,648\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "keras_model.summary()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [],
   "source": [
    "keras_predictions = keras_model.predict(x_test)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [],
   "source": [
    "keras_predictions_exact = []\n",
    "\n",
    "for i in range(0, len(keras_predictions)):\n",
    "    keras_predictions_exact.append(np.argmax(keras_predictions[i]))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "actual:  0.0  - prediction:  6\n",
      "actual:  1.0  - prediction:  4\n",
      "actual:  4.0  - prediction:  4\n",
      "actual:  6.0  - prediction:  6\n",
      "actual:  3.0  - prediction:  4\n"
     ]
    }
   ],
   "source": [
    "correctly_classified = 0\n",
    "\n",
    "for i in range(0, keras_predictions.shape[0]):\n",
    "    if i < 5:\n",
    "        print(\"actual: \",y_test[i],\" - prediction: \" ,np.argmax(keras_predictions[i]))#,\"(\",keras_predictions[i],\")\")\n",
    "    \n",
    "    if y_test[i] == np.argmax(keras_predictions[i]):\n",
    "        correctly_classified = correctly_classified + 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#this must be equal to autokeras_score but this is not! it seems exporting keras wouldn't export weights. It must be retrained.\n",
    "correctly_classified/predictions.shape[0] == autokeras_score"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
